﻿using CarRental.DDL;
using CarRental.Model;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Web;

namespace CarRental.Helpers {
    public class OptionItems {


        public class GeneralStatus {
            public String Key { get; set; }
            public String Title { get; set; }
        };

        public class ShortGeneralStatus {
            public short Key { get; set; }
            public String Title { get; set; }
        };

        public class StatusLst : ObservableCollection<GeneralStatus> {
            public StatusLst() {
            }

            public void Add(string key, string title) {
                Add(new GeneralStatus() { Key = key, Title = title });
            }
        }

        public class ShortStatusLst : ObservableCollection<ShortGeneralStatus> {
            public ShortStatusLst() {
            }

            public void Add(short key, string title) {
                Add(new ShortGeneralStatus() { Key = key, Title = title });
            }
        }

        //public class CheckBoxValLst : StatusLst {
        //    public CheckBoxValLst() {
        //        Add("Y", Boolean.TrueString);
        //        Add("N", Boolean.FalseString);
        //    }
        //}

        public class UserStatusLst : StatusLst {
            public UserStatusLst(bool pShowAllOption) {
                if (pShowAllOption) {
                    Add("", "All");
                }
                Add("A", "Active");
                Add("T", "Terminate");
            }
        }

        public class YesNoLst : StatusLst {
            public YesNoLst(bool pShowAllOption) {
                if (pShowAllOption) {
                    Add("", "All");
                }
                Add("Y", "Yes");
                Add("N", "No");
            }
        }

        public class OrderStatusLst : StatusLst {
            public OrderStatusLst(bool pShowAllOption) {
                if (pShowAllOption) {
                    Add("", "All");
                }
                Add("NC", "Not Confirm");
                Add("C", "Confirm");
                Add("R", "Reschedule");
                Add("T", "Cancel");
                Add("D", "Complete");
            }
        }

        public class UserTypeLst : StatusLst {
            public UserTypeLst(bool pShowAllOption, string pUserType) {
                if (pShowAllOption) {
                    Add("", "All");
                }
                switch (pUserType) {
                    case "ADMIN":
                        Add("ADMIN", "Administrator");
                        Add("STAFF", "Staff");
                        Add("CUSTOMER", "Customer");
                        break;
                    case "STAFF":
                        Add("STAFF", "Staff");
                        Add("CUSTOMER", "Customer");
                        break;
                    case "CUSTOMER":
                        Add("CUSTOMER", "Customer");
                        break;
                    default:
                        Add("CUSTOMER", "Customer");
                        break;
                }
            }
        }

        public class ColorLst : StatusLst {
            public ColorLst(bool pShowAllOption) {
                if (pShowAllOption) {
                    Add("", "All");
                }
                Add("RED", "Red");
                Add("BLUE", "Blue");
                Add("YELLOW", "Yellow");
                Add("GREEN", "Green");
                Add("PURPLE", "Purple");
                Add("WHITE", "White");
                Add("BLACK", "Black");
            }
        }

        public class ShopLst : StatusLst {
            public ShopLst(bool pShowAllOption) {
                if (pShowAllOption) {
                    Add("", "All");
                }
                DbAccess _dbAccess = new DbAccess();
                var _lst = _dbAccess.GetShop().ToList<shop>();
                foreach (var item in _lst) {
                    Add(item.shopcode, item.shopname);
                }

            }
        }

        public class CarTypeLst : StatusLst {
            public CarTypeLst(bool pShowAllOption) {
                if (pShowAllOption) {
                    Add("", "All");
                }
                DbAccess _dbAccess = new DbAccess();
                var _lst = _dbAccess.GetCarType().ToList<car_type>();
                foreach (var item in _lst) {
                    Add(item.car_typecode, item.car_type1);
                }

            }
        }

        public class DepotLst : StatusLst {
            public DepotLst(bool pShowAllOption) {
                if (pShowAllOption) {
                    Add("", "All");
                }
                DbAccess _dbAccess = new DbAccess();
                var _lst = _dbAccess.GetDepot().ToList<depot>();
                foreach (var item in _lst) {
                    Add(item.depot_no, item.depot_name);
                }

            }
        }

        public class DriveTrainsLst : StatusLst {
            public DriveTrainsLst(bool pShowAllOption) {
                if (pShowAllOption) {
                    Add("", "All");
                }
                DbAccess _dbAccess = new DbAccess();
                var _lst = _dbAccess.GetDrivetrains().ToList<drivetrain>();
                foreach (var item in _lst) {
                    Add(item.drivetrains_no, item.drivetrains_name);
                }

            }
        }

    }
}